home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: Gerald Feldman <gaf@zk3.dec.com>
- Newsgroups: comp.lang.c.moderated,comp.lang.c
- Subject: Re: Test for infinity?
- Date: 28 Feb 1996 18:55:30 -0600
- Organization: Digital Unix Development Environment
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4h2ti2$1jc@solutions.solon.com>
- References: <4gfci8$2jd@solutions.solon.com>
- NNTP-Posting-Host: solutions.solon.com
- X-Mailer: Mozilla 2.0 (X11; I; OSF1 T4.0 alpha)
-
- John J. Har wrote:
- >
- > Is there any ANSI function or code snippet that would test a double for
- > (positive) infinity? For that matter, how about for denormals and NaN's?
- >
- > Please send responses (or copies of posts) to me by email, since I don't
- > check these newsgroups frequently.
- John,
- As I mentioned in a previous email, I would send something to you.
- NaNs, Infinities, and denormals are not included as part of the C
- standard. They are covered by other standards, such as IEEE and XPG4
- (Unix). IEEE only requires certain properties, such as NaN, Infinity,
- and denormals. XPG4 defines the isnan() function, which reports non-zero
- when its argument is a NaN. IEEE 754-1985 does recommend function
- class(). Digital Unix implements that as fp_class. This function returns
- Constant Class
- _____________________________________________________
- FP_SNAN Signaling NaN (Not-a-Number)
- FP_QNAN Quiet NaN (Not-a-Number)
- FP_POS_INF +infinity
- FP_NEG_INF -infinity
- FP_POS_NORM Positive normalized
- FP_NEG_NORM Negative normalized
- FP_POS_DENORM Positive denormalized
- FP_NEG_DENORM Negative denormalized
- FP_POS_ZERO +0.0 (positive zero)
- FP_NEG_ZERO -0.0 (negative zero)
-
- There is also an IEEE finite() function.
-
- Those systems supporting IEEE functionality should have all of these
- functions available, though posssibly in some different forms.
-
- --
- Jerry Feldman Digital Unix Development Environment
- Digital Equipment Corp. Nashua, NH 03062-9987
- gaf@zk3.dec.com, gaf@bcs.org
-